﻿// JScript File



//***********************灾害监测-病虫害****************
//作物病虫害监测模块
function loadDisease()
{
    //清空div内所有的子元素element.
    if($('#wizard').children().length > 0)
    {
        $('#wizard').empty();
    }
    $("#forData").data("dt","disease");      
    //创建第一级div元素  
    var divMenu = document.createElement("div");
    divMenu.className = "basic";
    divMenu.id = "menuContent";
    divMenu.style.float = "left";
    
    //创建标题  
    var hrefTitle1 = document.createElement("a");
    var hrefTitle2 = document.createElement("a");
    var hrefTitle3 = document.createElement("a");
    var hrefTitle4 = document.createElement("a");
    
    var title1 = document.createTextNode("提取作物植被指数");
    var title2 = document.createTextNode("筛选病虫害指数与植被指数");
    var title3 = document.createTextNode("建立病虫害监测模型");
    var title4 = document.createTextNode("病虫害分级与制图");
    
    hrefTitle1.appendChild(title1);
    hrefTitle2.appendChild(title2);
    hrefTitle3.appendChild(title3);
    hrefTitle4.appendChild(title4);

    var modeltype="Disease";  //添加灾害类型判断
    //创建内容div元素 
    if(USER_ROLE_INDEX.indexOf('0002') > -1) //判断用户是否具有高级权限（0001——查询； 0002——分析）
    { 
        var divContents1 = createRSIndexDiv_Disease(modeltype);
        var divContents2 = createParamRelateDiv_Disease();
        var divContents3 = createModelSelectDiv_Disease(modeltype);
        var divContents4 = createDrawGrowingGraphDiv_Disease(modeltype);
        
        //添加标题和内容div到主div
        with($(divMenu))
        {
            append(hrefTitle1);
            append(divContents1);
            append(hrefTitle2);
            append(divContents2);
            append(hrefTitle3);
            append(divContents3);
            append(hrefTitle4);
            append(divContents4);
        }    
    }
    else
    {
        var divContents1 = createRSIndexDiv_Disease(modeltype);
        var divContents4 = createDrawGrowingGraphDiv_Disease(modeltype);
        
        //添加标题和内容div到主div
        with($(divMenu))
        {
            append(hrefTitle1);
            append(divContents1);
            append(hrefTitle4);
            append(divContents4);
        }    
        
    }

    $("#wizard").append(divMenu);
    jQuery(divMenu).accordion(); 
      
}
//**********************灾害监测--干旱***************
//作物干旱监测模块--框体设计
function loadDrought()
{
    //清空div内所有的子元素element.
    if($('#wizard').children().length > 0)
    {
        $('#wizard').empty();
    }
    $("#forData").data("dt","drought");      
    //创建第一级div元素  
    var divMenu = document.createElement("div");
    divMenu.className = "basic";
    divMenu.id = "menuContent";
    divMenu.style.float = "left";
    
    //创建标题  
    var hrefTitle1 = document.createElement("a");
    var hrefTitle2 = document.createElement("a");
    var hrefTitle3 = document.createElement("a");
    var hrefTitle4 = document.createElement("a");
    
    var title1 = document.createTextNode("提取作物植被指数");
    var title2 = document.createTextNode("筛选土壤含水量与旱情指数");
    var title3 = document.createTextNode("建立旱情监测模型");
    var title4 = document.createTextNode("旱情分级与制图");
    
    hrefTitle1.appendChild(title1);
    hrefTitle2.appendChild(title2);
    hrefTitle3.appendChild(title3);
    hrefTitle4.appendChild(title4);

    var modeltype="Drought"; 
    //创建内容div元素 
    if(USER_ROLE_INDEX.indexOf('0002') > -1) //判断用户是否具有高级权限（0001——查询； 0002——分析）
    { 
        var divContents1 = createRSIndexDiv_Disease(modeltype);
        var divContents2 = createParamRelateDiv_Drought();
        var divContents3 = createModelSelectDiv_Disease(modeltype);
        var divContents4 = createDrawGrowingGraphDiv_Disease(modeltype);
        
        //添加标题和内容div到主div
        with($(divMenu))
        {
            append(hrefTitle1);
            append(divContents1);
            append(hrefTitle2);
            append(divContents2);
            append(hrefTitle3);
            append(divContents3);
            append(hrefTitle4);
            append(divContents4);
        }    
    }
    else
    {
        var divContents1 = createRSIndexDiv_Disease(modeltype);
        var divContents2 = createParamRelateDiv_Drought();
        var divContents3 = createModelSelectDiv_Disease(modeltype);
        var divContents4 = createDrawGrowingGraphDiv_Disease(modeltype);
        
        //添加标题和内容div到主div
        with($(divMenu))
        {
            append(hrefTitle1);
            append(divContents1);
            append(hrefTitle2);
            append(divContents2);
            append(hrefTitle3);
            append(divContents3);
            append(hrefTitle4);
            append(divContents4);
        }            
    }

    $("#wizard").append(divMenu);
    jQuery(divMenu).accordion(); 
}


//调用用户管理页面
function loadUserManager()
{
     if(USER_ROLE_INDEX == "00010002")
     {
         var UserManageUrl = "USERNAME=" + USER_NAME + "&USERDISTRICTID=" + USER_DISTRICT_ID;
         var encUrl = stringToHex(des(USER_ROLE_INDEX,UserManageUrl,1,0));
         window.open("UserManage.htm?" + encUrl);
     }
}
//调用角色管理页面
function loadRoleManager()
{
     if(USER_ROLE_INDEX == "00010002")
     {
         var UserManageUrl = "USERNAME=" + USER_NAME + "&USERDISTRICTID=" + USER_DISTRICT_ID;
         var encUrl = stringToHex(des(USER_ROLE_INDEX,UserManageUrl,1,0));
         window.open("UserManage.htm?" + encUrl);//角色管理页面名称需要改
     }
}